package com.one.rope.mvp.web.controller;

import com.one.rope.mvp.web.business.service.ICommonDataService;
import com.one.rope.mvp.basecore.bean.ResponseObject;
import com.one.rope.mvp.web.common.dto.common.AreaInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Weijian.liu
 * @desc 通用数据控制器
 * @date 2020/02/19
 */
@Api(tags = "C1通用数据模块")
@RestController
@RequestMapping("/common")
@Slf4j
public class CommonDataController extends BaseController {

  @Autowired
  ICommonDataService commonDataService;

  @ApiOperation(value = "COM001 项目亮点标签列表", notes = "项目亮点标签接口")
  @GetMapping("/projectSpotTagList")
  public ResponseObject projectSpotTagList() {
    try {
      return commonDataService.projectSpotTagList();
    } catch (Exception e) {
      log.error("/common/projectSpotTagList接口异常", e);
      return ResponseObject.systemError(e);
    }
  }

  @ApiOperation(value = "COM002 成员擅长技能列表", notes = "成员擅长技能列表接口")
  @GetMapping("/memberSkilledTagList")
  public ResponseObject memberSkilledTageList() {
    try {
      return commonDataService.memberSkilledTageList();
    } catch (Exception e) {
      log.error("/common/memberSkilledTagListt接口异常", e);
      return ResponseObject.systemError(e);
    }
  }

  @ApiOperation(value = "COM003 行政区域列表", notes = "行政区域列表接口", response = AreaInfoVO.class)
  @GetMapping("/areaInfoList")
  public ResponseObject areaInfoList() {
    try {
      return commonDataService.areaInfoList();
    } catch (Exception e) {
      log.error("/common/areaInfoList接口异常", e);
      return ResponseObject.systemError(e);
    }
  }

  @ApiOperation(value = "COM004 公司层面标签列表", notes = "公司层面标签列表接口")
  @GetMapping("/companyLayTagList")
  public ResponseObject companyLayTagList() {
    try {
      return commonDataService.companyLayTagList();
    } catch (Exception e) {
      log.error("/common/companyLayTagList接口异常", e);
      return ResponseObject.systemError(e);
    }
  }

  @ApiOperation(value = "COM006 个人层面标签列表", notes = "个人层面标签列表接口")
  @GetMapping("/personalLayTagList")
  public ResponseObject personalLayTagList() {
    try {
      return commonDataService.personalLayTagList();
    } catch (Exception e) {
      log.error("/common/personalLayTagList接口异常", e);
      return ResponseObject.systemError(e);
    }
  }

}
